package com.sentiment.database.bean;

import java.util.Date;
import java.util.List;

import org.bson.Document;import org.bson.types.ObjectId;

public class SearchRecord{
	@Override
	public String toString() {
		return "SearchRecord [_id=" + _id + ", date=" + date + ", user_id=" + user_id + ", keyword_id=" + keyword_id
				+ ", source=" + source + ", type=" + type + "]";
	}


	public static final String dbName = "SentimentDB";
	public static final String collection = "SearchRecord";
	
	private ObjectId _id;
	private Date date;
	private String user_id;
	private String keyword_id;
	private List<String> source;
	private List<String> type;
	
	public SearchRecord(Document doc){
		super();
		_id = doc.getObjectId("_id");
		date = doc.getDate("date");
		user_id = doc.getString("user_id");
		keyword_id = doc.getString("keyword_id");
		source = (List<String>)doc.get("source");
		type = (List<String>)doc.get("type");
		
	}
	
	
	public SearchRecord(Date date, String user_id, String keyword_id, List<String> source, List<String> type) {
		super();
		this.date = date;
		this.user_id = user_id;
		this.keyword_id = keyword_id;
		this.source = source;
		this.type = type;
	}


	public String get_id() {
		return _id.toString();
	}


	public void set_id(String _id) {
		this._id = new ObjectId(_id);
	}


	public Date getDate() {
		return date;
	}


	public void setDate(Date date) {
		this.date = date;
	}


	public String getUser_id() {
		return user_id;
	}


	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}


	public String getKeyword_id() {
		return keyword_id;
	}


	public void setKeyword_id(String keyword_id) {
		this.keyword_id = keyword_id;
	}


	public List<String> getSource() {
		return source;
	}


	public void setSource(List<String> source) {
		this.source = source;
	}


	public List<String> getType() {
		return type;
	}


	public void setType(List<String> type) {
		this.type = type;
	}


	public Document toDocument() {
		// TODO Auto-generated method stub
		return new Document("_id",_id).append("date", date).append("user_id", user_id).append("keyword_id", keyword_id).append("source", source).append("type", type);
	}


	
	
}
